#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

typedef pair<int, int> PII;

int findVal(vector<PII> &arr, int time)
{
    int lo = 0, hi = arr.size()-1;
    while( lo < hi) {
	int mid = lo + (hi-lo)/2;
	if (arr[mid].first == time) return arr[mid].second;
	else if (time < arr[mid].first) hi = mid - 1;
	else lo = mid + 1;
    }
    return arr[lo].second;
}

/* <1,3>, <8,6>, <10, 11>, <19, 4>, <23, 9> */
int main(int argc, char **argv)
{
    vector<PII> arr;
    arr.push_back(PII(1,3));
    arr.push_back(PII(8,6));
    arr.push_back(PII(10,11));
    arr.push_back(PII(19,4));
    arr.push_back(PII(23,9));
    cout << findVal(arr, 6) << endl;
    cout << findVal(arr, 10) << endl;
}
